<!DOCTYPE html>
<html xmlns:v-on="http://www.w3.org/1999/xhtml">

	<head>
		<meta charset="utf-8" />
		<title>v-on:keydown</title>
		<script src="js/vuejs-2.5.16.js"></script>
	</head>

	<body>
		<div id="app">
			<input type="text" v-on:keydown="fun($event)">
<!--			<input type="text" onkeydown="showKeyCode()"/>-->
		</div>
	</body>
	<script>
		//view model,$event是Vue中的对象，和传统js中event对象类似
		new Vue({
			el:"#app",
			methods:{
				fun:function(event){
					var keyCode = event.keyCode;
					alert(keyCode);
				}
			}
		})

		//传统js方法
		function showKeyCode() {
			var keyCode = event.keyCode;
			alert(keyCode);
		}
	</script>
	
	

</html>